package me.zk.practice1.hw;

import java.util.Scanner;

public class HWBJ17 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int len = Integer.parseInt(scanner.nextLine());

        int min = Integer.MAX_VALUE;
        for (int i = 0; i < len; i++) {
            int t = scanner.nextInt();
            int m = scanner.nextInt();
            if (m >=128) {
                String s = Integer.toString(m,2);
                int mant = Integer.parseInt(s.substring(4),2);

                int exp = Integer.parseInt(s.substring(1,4),2);
                m = (mant|0x10)<<(exp+3);

            }
            int cost = m + t;
            min = Math.min(cost,min);
        }
        System.out.println(min);
    }
}
